/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  
  checkConfig(config);
  @endpoint = getEndpoint('airec', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AttachDatasetResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: long(name='GmtCreate'),
    gmtModified?: long(name='GmtModified'),
    instanceId?: string(name='InstanceId'),
    state?: string(name='State'),
    versionId?: string(name='VersionId'),
  }(name='Result'),
}

model AttachDatasetResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AttachDatasetResponseBody(name='body'),
}

async function attachDataset(InstanceId: string, VersionId: string): AttachDatasetResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return attachDatasetWithOptions(InstanceId, VersionId, headers, runtime);
}

async function attachDatasetWithOptions(InstanceId: string, VersionId: string, headers: map[string]string, runtime: Util.RuntimeOptions): AttachDatasetResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'AttachDataset',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/dataSets/${OpenApiUtil.getEncodeParam(VersionId)}/actions/current`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model CreateDiversifyResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    name?: string(name='Name'),
    parameter?: {
      categoryIndex?: int32(name='CategoryIndex'),
      window?: int32(name='Window'),
    }(name='Parameter'),
  }(name='Result'),
}

model CreateDiversifyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateDiversifyResponseBody(name='body'),
}

async function createDiversify(InstanceId: string): CreateDiversifyResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createDiversifyWithOptions(InstanceId, headers, runtime);
}

async function createDiversifyWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): CreateDiversifyResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CreateDiversify',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/diversifies`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model CreateInstanceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    instanceId?: string(name='InstanceId'),
  }(name='Result'),
}

model CreateInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateInstanceResponseBody(name='body'),
}

async function createInstance(): CreateInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createInstanceWithOptions(headers, runtime);
}

async function createInstanceWithOptions(headers: map[string]string, runtime: Util.RuntimeOptions): CreateInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CreateInstance',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model CreateMixResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    name?: string(name='Name'),
    parameter?: {
      settings?: [ 
        {
          name?: string(name='Name'),
          value?: int32(name='Value'),
        }
      ](name='Settings'),
    }(name='Parameter'),
  }(name='Result'),
}

model CreateMixResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateMixResponseBody(name='body'),
}

async function createMix(InstanceId: string): CreateMixResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createMixWithOptions(InstanceId, headers, runtime);
}

async function createMixWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): CreateMixResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CreateMix',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/mixes`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model CreateRuleResponseBody = {
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    ruleId?: string(name='RuleId'),
    status?: string(name='Status'),
  }(name='Result'),
}

model CreateRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateRuleResponseBody(name='body'),
}

async function createRule(InstanceId: string): CreateRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createRuleWithOptions(InstanceId, headers, runtime);
}

async function createRuleWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): CreateRuleResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CreateRule',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/rules`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model CreateSceneRequest {
  dryRun?: boolean(name='DryRun'),
}

model CreateSceneResponseBody = {
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    sceneId?: string(name='SceneId'),
    status?: string(name='Status'),
  }(name='Result'),
}

model CreateSceneResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateSceneResponseBody(name='body'),
}

async function createScene(InstanceId: string, request: CreateSceneRequest): CreateSceneResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createSceneWithOptions(InstanceId, request, headers, runtime);
}

async function createSceneWithOptions(InstanceId: string, request: CreateSceneRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateSceneResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.dryRun)) {
    query['DryRun'] = request.dryRun;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateScene',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/scenes`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DeleteDataSetResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: long(name='GmtCreate'),
    gmtModified?: long(name='GmtModified'),
    instanceId?: string(name='InstanceId'),
    state?: string(name='State'),
    versionId?: string(name='VersionId'),
  }(name='Result'),
}

model DeleteDataSetResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteDataSetResponseBody(name='body'),
}

async function deleteDataSet(InstanceId: string, VersionId: string): DeleteDataSetResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteDataSetWithOptions(InstanceId, VersionId, headers, runtime);
}

async function deleteDataSetWithOptions(InstanceId: string, VersionId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteDataSetResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteDataSet',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/dataSets/${OpenApiUtil.getEncodeParam(VersionId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DeleteDiversifyResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    name?: string(name='Name'),
    parameter?: {
      categoryIndex?: int32(name='CategoryIndex'),
      window?: int32(name='Window'),
    }(name='Parameter'),
  }(name='Result'),
}

model DeleteDiversifyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteDiversifyResponseBody(name='body'),
}

async function deleteDiversify(InstanceId: string, Name: string): DeleteDiversifyResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteDiversifyWithOptions(InstanceId, Name, headers, runtime);
}

async function deleteDiversifyWithOptions(InstanceId: string, Name: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteDiversifyResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteDiversify',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/diversifies/${OpenApiUtil.getEncodeParam(Name)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DeleteMixResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    name?: string(name='Name'),
    parameter?: {
      settings?: [ 
        {
          name?: string(name='Name'),
          value?: string(name='Value'),
        }
      ](name='Settings'),
    }(name='Parameter'),
  }(name='Result'),
}

model DeleteMixResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteMixResponseBody(name='body'),
}

async function deleteMix(InstanceId: string, Name: string): DeleteMixResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteMixWithOptions(InstanceId, Name, headers, runtime);
}

async function deleteMixWithOptions(InstanceId: string, Name: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteMixResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteMix',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/mixes/${OpenApiUtil.getEncodeParam(Name)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DeleteSceneResponseBody = {
  requestId?: string(name='RequestId'),
  result?: {
    sceneId?: string(name='SceneId'),
  }(name='Result'),
}

model DeleteSceneResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteSceneResponseBody(name='body'),
}

async function deleteScene(InstanceId: string, SceneId: string): DeleteSceneResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteSceneWithOptions(InstanceId, SceneId, headers, runtime);
}

async function deleteSceneWithOptions(InstanceId: string, SceneId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteSceneResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteScene',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/scenes/${OpenApiUtil.getEncodeParam(SceneId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DescribeDataSetMessageResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      errorLevel?: string(name='ErrorLevel'),
      errorType?: string(name='ErrorType'),
      message?: string(name='Message'),
      timestamp?: string(name='Timestamp'),
    }
  ](name='Result'),
}

model DescribeDataSetMessageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeDataSetMessageResponseBody(name='body'),
}

async function describeDataSetMessage(InstanceId: string, VersionId: string): DescribeDataSetMessageResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeDataSetMessageWithOptions(InstanceId, VersionId, headers, runtime);
}

async function describeDataSetMessageWithOptions(InstanceId: string, VersionId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeDataSetMessageResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeDataSetMessage',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/dataSets/${OpenApiUtil.getEncodeParam(VersionId)}/messages`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DescribeDataSetReportResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    detail?: [ 
      {
        activeItem?: long(name='ActiveItem'),
        bizDate?: long(name='BizDate'),
        click?: long(name='Click'),
        clickUser?: long(name='ClickUser'),
        ctr?: float(name='Ctr'),
        perUvBhv?: float(name='PerUvBhv'),
        perUvClick?: float(name='PerUvClick'),
        pv?: long(name='Pv'),
        uv?: long(name='Uv'),
        uvCtr?: float(name='UvCtr'),
      }
    ](name='Detail'),
    overall?: {
      bhvCount?: int32(name='BhvCount'),
      bhvLegalRate?: float(name='BhvLegalRate'),
      itemCompleteRate?: float(name='ItemCompleteRate'),
      itemItemCount?: int32(name='ItemItemCount'),
      itemLegalRate?: float(name='ItemLegalRate'),
      itemLoginRate?: float(name='ItemLoginRate'),
      itemRepetitiveRate?: float(name='ItemRepetitiveRate'),
      userCompleteRate?: float(name='UserCompleteRate'),
      userLegalRate?: float(name='UserLegalRate'),
      userLoginRate?: float(name='UserLoginRate'),
      userRepetitiveRate?: float(name='UserRepetitiveRate'),
      userUserCount?: int32(name='UserUserCount'),
    }(name='Overall'),
  }(name='Result'),
}

model DescribeDataSetReportResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeDataSetReportResponseBody(name='body'),
}

async function describeDataSetReport(InstanceId: string, VersionId: string): DescribeDataSetReportResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeDataSetReportWithOptions(InstanceId, VersionId, headers, runtime);
}

async function describeDataSetReportWithOptions(InstanceId: string, VersionId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeDataSetReportResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeDataSetReport',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/dataSets/${OpenApiUtil.getEncodeParam(VersionId)}/report`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DescribeDiversifyResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    name?: string(name='Name'),
    parameter?: {
      categoryIndex?: int32(name='CategoryIndex'),
      window?: int32(name='Window'),
    }(name='Parameter'),
  }(name='Result'),
}

model DescribeDiversifyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeDiversifyResponseBody(name='body'),
}

async function describeDiversify(InstanceId: string, Name: string): DescribeDiversifyResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeDiversifyWithOptions(InstanceId, Name, headers, runtime);
}

async function describeDiversifyWithOptions(InstanceId: string, Name: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeDiversifyResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeDiversify',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/diversifies/${OpenApiUtil.getEncodeParam(Name)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DescribeExposureSettingsResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    durationSeconds?: int32(name='DurationSeconds'),
    scenarioBased?: boolean(name='ScenarioBased'),
  }(name='Result'),
}

model DescribeExposureSettingsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeExposureSettingsResponseBody(name='body'),
}

async function describeExposureSettings(InstanceId: string): DescribeExposureSettingsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeExposureSettingsWithOptions(InstanceId, headers, runtime);
}

async function describeExposureSettingsWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeExposureSettingsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeExposureSettings',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/exposure-settings`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DescribeInstanceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    chargeType?: string(name='ChargeType'),
    commodityCode?: string(name='CommodityCode'),
    dataSetVersion?: string(name='DataSetVersion'),
    expiredTime?: string(name='ExpiredTime'),
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    industry?: string(name='Industry'),
    instanceId?: string(name='InstanceId'),
    lockMode?: string(name='LockMode'),
    name?: string(name='Name'),
    regionId?: string(name='RegionId'),
    scene?: string(name='Scene'),
    status?: string(name='Status'),
    type?: string(name='Type'),
  }(name='Result'),
}

model DescribeInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeInstanceResponseBody(name='body'),
}

async function describeInstance(InstanceId: string): DescribeInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeInstanceWithOptions(InstanceId, headers, runtime);
}

async function describeInstanceWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeInstance',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DescribeMixResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    name?: string(name='Name'),
    parameter?: {
      settings?: [ 
        {
          name?: string(name='Name'),
          value?: int32(name='Value'),
        }
      ](name='Settings'),
    }(name='Parameter'),
  }(name='Result'),
}

model DescribeMixResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeMixResponseBody(name='body'),
}

async function describeMix(InstanceId: string, Name: string): DescribeMixResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeMixWithOptions(InstanceId, Name, headers, runtime);
}

async function describeMixWithOptions(InstanceId: string, Name: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeMixResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeMix',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/mixes/${OpenApiUtil.getEncodeParam(Name)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DescribeQuotaResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    currentQps?: int32(name='CurrentQps'),
    itemCount?: long(name='ItemCount'),
    itemCountUsed?: long(name='ItemCountUsed'),
    qps?: int32(name='Qps'),
    userCount?: long(name='UserCount'),
    userCountUsed?: long(name='UserCountUsed'),
  }(name='Result'),
}

model DescribeQuotaResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeQuotaResponseBody(name='body'),
}

async function describeQuota(InstanceId: string): DescribeQuotaResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeQuotaWithOptions(InstanceId, headers, runtime);
}

async function describeQuotaWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeQuotaResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeQuota',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/quota`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DescribeRegionsRequest {
  acceptLanguage?: string(name='AcceptLanguage'),
}

model DescribeRegionsResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      consoleUrl?: string(name='ConsoleUrl'),
      endpoint?: string(name='Endpoint'),
      localName?: string(name='LocalName'),
      regionId?: string(name='RegionId'),
      status?: string(name='Status'),
    }
  ](name='Result'),
}

model DescribeRegionsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeRegionsResponseBody(name='body'),
}

async function describeRegions(request: DescribeRegionsRequest): DescribeRegionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeRegionsWithOptions(request, headers, runtime);
}

async function describeRegionsWithOptions(request: DescribeRegionsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeRegionsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.acceptLanguage)) {
    query['AcceptLanguage'] = request.acceptLanguage;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRegions',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/configurations/regions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DescribeRuleRequest {
  ruleType?: string(name='RuleType'),
  sceneId?: string(name='SceneId'),
}

model DescribeRuleResponseBody = {
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    ruleId?: string(name='RuleId'),
    status?: string(name='Status'),
  }(name='Result'),
}

model DescribeRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeRuleResponseBody(name='body'),
}

async function describeRule(InstanceId: string, RuleId: string, request: DescribeRuleRequest): DescribeRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeRuleWithOptions(InstanceId, RuleId, request, headers, runtime);
}

async function describeRuleWithOptions(InstanceId: string, RuleId: string, request: DescribeRuleRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeRuleResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.ruleType)) {
    query['RuleType'] = request.ruleType;
  }
  if (!Util.isUnset(request.sceneId)) {
    query['SceneId'] = request.sceneId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRule',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/rules/${OpenApiUtil.getEncodeParam(RuleId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DescribeSceneResponseBody = {
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    sceneId?: string(name='SceneId'),
    status?: string(name='Status'),
  }(name='Result'),
}

model DescribeSceneResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeSceneResponseBody(name='body'),
}

async function describeScene(InstanceId: string, SceneId: string): DescribeSceneResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeSceneWithOptions(InstanceId, SceneId, headers, runtime);
}

async function describeSceneWithOptions(InstanceId: string, SceneId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeSceneResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeScene',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/scenes/${OpenApiUtil.getEncodeParam(SceneId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DescribeSceneThroughputResponseBody = {
  requestId?: string(name='RequestId'),
  result?: {
    pvCount?: long(name='PvCount'),
  }(name='Result'),
}

model DescribeSceneThroughputResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeSceneThroughputResponseBody(name='body'),
}

async function describeSceneThroughput(InstanceId: string, SceneId: string): DescribeSceneThroughputResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeSceneThroughputWithOptions(InstanceId, SceneId, headers, runtime);
}

async function describeSceneThroughputWithOptions(InstanceId: string, SceneId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeSceneThroughputResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeSceneThroughput',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/scenes/${OpenApiUtil.getEncodeParam(SceneId)}/throughput`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DescribeSyncReportDetailRequest {
  endTime?: long(name='EndTime'),
  levelType?: string(name='LevelType'),
  startTime?: long(name='StartTime'),
  type?: string(name='Type'),
}

model DescribeSyncReportDetailResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      defaultDisplay?: boolean(name='DefaultDisplay'),
      errorCount?: int32(name='ErrorCount'),
      errorPercent?: float(name='ErrorPercent'),
      historyData?: [ 
        {
          endTime?: long(name='EndTime'),
          errorPercent?: float(name='ErrorPercent'),
          startTime?: long(name='StartTime'),
        }
      ](name='HistoryData'),
      sampleDisplay?: boolean(name='SampleDisplay'),
      type?: string(name='Type'),
    }
  ](name='Result'),
}

model DescribeSyncReportDetailResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeSyncReportDetailResponseBody(name='body'),
}

async function describeSyncReportDetail(InstanceId: string, request: DescribeSyncReportDetailRequest): DescribeSyncReportDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeSyncReportDetailWithOptions(InstanceId, request, headers, runtime);
}

async function describeSyncReportDetailWithOptions(InstanceId: string, request: DescribeSyncReportDetailRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeSyncReportDetailResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.levelType)) {
    query['LevelType'] = request.levelType;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSyncReportDetail',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/sync-reports/detail`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DescribeSyncReportOutliersRequest {
  endTime?: long(name='EndTime'),
  key?: string(name='Key'),
  levelType?: string(name='LevelType'),
  startTime?: long(name='StartTime'),
  type?: string(name='Type'),
}

model DescribeSyncReportOutliersResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: map[string]any(name='Result'),
}

model DescribeSyncReportOutliersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeSyncReportOutliersResponseBody(name='body'),
}

async function describeSyncReportOutliers(InstanceId: string, request: DescribeSyncReportOutliersRequest): DescribeSyncReportOutliersResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeSyncReportOutliersWithOptions(InstanceId, request, headers, runtime);
}

async function describeSyncReportOutliersWithOptions(InstanceId: string, request: DescribeSyncReportOutliersRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeSyncReportOutliersResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.key)) {
    query['Key'] = request.key;
  }
  if (!Util.isUnset(request.levelType)) {
    query['LevelType'] = request.levelType;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSyncReportOutliers',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/sync-reports/outliers`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DescribeUserMetricsRequest {
  endTime?: long(name='EndTime'),
  metricType?: string(name='MetricType'),
  startTime?: long(name='StartTime'),
}

model DescribeUserMetricsResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      dataPoints?: [ 
        {
          endTime?: long(name='EndTime'),
          startTime?: long(name='StartTime'),
          val?: float(name='Val'),
        }
      ](name='DataPoints'),
      sceneId?: string(name='SceneId'),
    }
  ](name='Result'),
}

model DescribeUserMetricsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeUserMetricsResponseBody(name='body'),
}

async function describeUserMetrics(InstanceId: string, request: DescribeUserMetricsRequest): DescribeUserMetricsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeUserMetricsWithOptions(InstanceId, request, headers, runtime);
}

async function describeUserMetricsWithOptions(InstanceId: string, request: DescribeUserMetricsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeUserMetricsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.metricType)) {
    query['MetricType'] = request.metricType;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeUserMetrics',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/metrics`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DowngradeInstanceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    instanceId?: string(name='InstanceId'),
  }(name='Result'),
}

model DowngradeInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DowngradeInstanceResponseBody(name='body'),
}

async function downgradeInstance(InstanceId: string): DowngradeInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return downgradeInstanceWithOptions(InstanceId, headers, runtime);
}

async function downgradeInstanceWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DowngradeInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DowngradeInstance',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/actions/downgrade`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListDashboardRequest {
  endDate?: long(name='EndDate'),
  page?: int32(name='Page'),
  sceneId?: string(name='SceneId'),
  size?: int32(name='Size'),
  startDate?: long(name='StartDate'),
  traceId?: string(name='TraceId'),
}

model ListDashboardResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    list?: [ 
      {
        activeItem?: long(name='ActiveItem'),
        bizDate?: long(name='BizDate'),
        click?: long(name='Click'),
        clickUser?: long(name='ClickUser'),
        ctr?: float(name='Ctr'),
        perUvBhv?: float(name='PerUvBhv'),
        perUvClick?: float(name='PerUvClick'),
        pv?: long(name='Pv'),
        sceneId?: string(name='SceneId'),
        traceId?: string(name='TraceId'),
        uv?: long(name='Uv'),
        uvCtr?: float(name='UvCtr'),
      }
    ](name='List'),
    num?: int32(name='Num'),
  }(name='Result'),
}

model ListDashboardResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListDashboardResponseBody(name='body'),
}

async function listDashboard(InstanceId: string, request: ListDashboardRequest): ListDashboardResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDashboardWithOptions(InstanceId, request, headers, runtime);
}

async function listDashboardWithOptions(InstanceId: string, request: ListDashboardRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDashboardResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endDate)) {
    query['EndDate'] = request.endDate;
  }
  if (!Util.isUnset(request.page)) {
    query['Page'] = request.page;
  }
  if (!Util.isUnset(request.sceneId)) {
    query['SceneId'] = request.sceneId;
  }
  if (!Util.isUnset(request.size)) {
    query['Size'] = request.size;
  }
  if (!Util.isUnset(request.startDate)) {
    query['StartDate'] = request.startDate;
  }
  if (!Util.isUnset(request.traceId)) {
    query['TraceId'] = request.traceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDashboard',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/dashboard/statistics`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListDashboardDetailsRequest {
  endTime?: long(name='EndTime'),
  metricType?: string(name='MetricType'),
  sceneIds?: string(name='SceneIds'),
  startTime?: long(name='StartTime'),
  traceIds?: string(name='TraceIds'),
}

model ListDashboardDetailsResponseBody = {
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      metricRes?: {
        detail?: map[string]any(name='Detail'),
        total?: map[string]any(name='Total'),
      }(name='MetricRes'),
      sceneId?: string(name='SceneId'),
      traceId?: string(name='TraceId'),
    }
  ](name='Result'),
}

model ListDashboardDetailsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListDashboardDetailsResponseBody(name='body'),
}

async function listDashboardDetails(InstanceId: string, request: ListDashboardDetailsRequest): ListDashboardDetailsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDashboardDetailsWithOptions(InstanceId, request, headers, runtime);
}

async function listDashboardDetailsWithOptions(InstanceId: string, request: ListDashboardDetailsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDashboardDetailsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.metricType)) {
    query['MetricType'] = request.metricType;
  }
  if (!Util.isUnset(request.sceneIds)) {
    query['SceneIds'] = request.sceneIds;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.traceIds)) {
    query['TraceIds'] = request.traceIds;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDashboardDetails',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/dashboard/details`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListDashboardDetailsFlowsRequest {
  endTime?: long(name='EndTime'),
  metricType?: string(name='MetricType'),
  sceneIds?: string(name='SceneIds'),
  startTime?: long(name='StartTime'),
  traceIds?: string(name='TraceIds'),
}

model ListDashboardDetailsFlowsResponseBody = {
  requestId?: string(name='RequestId'),
  result?: {
    metricData?: [ 
      {
        metricRes?: map[string]any(name='MetricRes'),
        sceneId?: string(name='SceneId'),
        traceId?: string(name='TraceId'),
      }
    ](name='MetricData'),
    metricType?: string(name='MetricType'),
  }(name='Result'),
}

model ListDashboardDetailsFlowsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListDashboardDetailsFlowsResponseBody(name='body'),
}

async function listDashboardDetailsFlows(InstanceId: string, request: ListDashboardDetailsFlowsRequest): ListDashboardDetailsFlowsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDashboardDetailsFlowsWithOptions(InstanceId, request, headers, runtime);
}

async function listDashboardDetailsFlowsWithOptions(InstanceId: string, request: ListDashboardDetailsFlowsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDashboardDetailsFlowsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.metricType)) {
    query['MetricType'] = request.metricType;
  }
  if (!Util.isUnset(request.sceneIds)) {
    query['SceneIds'] = request.sceneIds;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.traceIds)) {
    query['TraceIds'] = request.traceIds;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDashboardDetailsFlows',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/dashboard/details/flows`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListDashboardMetricsRequest {
  endTime?: long(name='EndTime'),
  metricType?: string(name='MetricType'),
  startTime?: long(name='StartTime'),
}

model ListDashboardMetricsResponseBody = {
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      detail?: [ 
        {
          endTime?: string(name='EndTime'),
          startTime?: string(name='StartTime'),
          val?: string(name='Val'),
        }
      ](name='Detail'),
      total?: map[string]any(name='Total'),
    }
  ](name='Result'),
}

model ListDashboardMetricsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListDashboardMetricsResponseBody(name='body'),
}

async function listDashboardMetrics(InstanceId: string, request: ListDashboardMetricsRequest): ListDashboardMetricsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDashboardMetricsWithOptions(InstanceId, request, headers, runtime);
}

async function listDashboardMetricsWithOptions(InstanceId: string, request: ListDashboardMetricsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDashboardMetricsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.metricType)) {
    query['MetricType'] = request.metricType;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDashboardMetrics',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/dashboard/metrics`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListDashboardMetricsFlowsRequest {
  endTime?: long(name='EndTime'),
  metricType?: string(name='MetricType'),
  startTime?: long(name='StartTime'),
}

model ListDashboardMetricsFlowsResponseBody = {
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      metricData?: map[string]any(name='MetricData'),
      metricType?: string(name='MetricType'),
    }
  ](name='Result'),
}

model ListDashboardMetricsFlowsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListDashboardMetricsFlowsResponseBody(name='body'),
}

async function listDashboardMetricsFlows(InstanceId: string, request: ListDashboardMetricsFlowsRequest): ListDashboardMetricsFlowsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDashboardMetricsFlowsWithOptions(InstanceId, request, headers, runtime);
}

async function listDashboardMetricsFlowsWithOptions(InstanceId: string, request: ListDashboardMetricsFlowsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDashboardMetricsFlowsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.metricType)) {
    query['MetricType'] = request.metricType;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDashboardMetricsFlows',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/dashboard/metrics/flows`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListDashboardParametersResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    sceneId?: [ string ](name='SceneId'),
    traceId?: [ string ](name='TraceId'),
  }(name='Result'),
}

model ListDashboardParametersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListDashboardParametersResponseBody(name='body'),
}

async function listDashboardParameters(InstanceId: string): ListDashboardParametersResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDashboardParametersWithOptions(InstanceId, headers, runtime);
}

async function listDashboardParametersWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListDashboardParametersResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListDashboardParameters',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/dashboard/parameters`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListDashboardUidResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    num?: int32(name='Num'),
    uid?: [ string ](name='Uid'),
  }(name='Result'),
}

model ListDashboardUidResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListDashboardUidResponseBody(name='body'),
}

async function listDashboardUid(InstanceId: string): ListDashboardUidResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDashboardUidWithOptions(InstanceId, headers, runtime);
}

async function listDashboardUidWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListDashboardUidResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListDashboardUid',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/dashboard/uid`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListDataSetResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      gmtCreate?: long(name='GmtCreate'),
      gmtModified?: long(name='GmtModified'),
      instanceId?: string(name='InstanceId'),
      state?: string(name='State'),
      versionId?: string(name='VersionId'),
    }
  ](name='Result'),
}

model ListDataSetResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListDataSetResponseBody(name='body'),
}

async function listDataSet(InstanceId: string): ListDataSetResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDataSetWithOptions(InstanceId, headers, runtime);
}

async function listDataSetWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListDataSetResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListDataSet',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/dataSets`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListDataSourceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      gmtCreate?: string(name='GmtCreate'),
      gmtModified?: string(name='GmtModified'),
      meta?: {
        accessKeyId?: string(name='AccessKeyId'),
        bucketName?: string(name='BucketName'),
        partition?: string(name='Partition'),
        path?: string(name='Path'),
        projectName?: string(name='ProjectName'),
        tableName?: string(name='TableName'),
        timestamp?: long(name='Timestamp'),
        type?: string(name='Type'),
      }(name='Meta'),
      tableName?: string(name='TableName'),
    }
  ](name='Result'),
}

model ListDataSourceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListDataSourceResponseBody(name='body'),
}

async function listDataSource(InstanceId: string): ListDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDataSourceWithOptions(InstanceId, headers, runtime);
}

async function listDataSourceWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListDataSourceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListDataSource',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/dataSources`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListDiversifyResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      gmtCreate?: string(name='GmtCreate'),
      gmtModified?: string(name='GmtModified'),
      name?: string(name='Name'),
      parameter?: {
        categoryIndex?: int32(name='CategoryIndex'),
        window?: int32(name='Window'),
      }(name='Parameter'),
    }
  ](name='Result'),
}

model ListDiversifyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListDiversifyResponseBody(name='body'),
}

async function listDiversify(InstanceId: string): ListDiversifyResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDiversifyWithOptions(InstanceId, headers, runtime);
}

async function listDiversifyWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListDiversifyResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListDiversify',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/diversifies`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListInstanceRequest {
  expiredTime?: string(name='ExpiredTime'),
  name?: string(name='Name'),
  status?: string(name='Status'),
  page?: int32(name='page'),
  size?: int32(name='size'),
}

model ListInstanceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      chargeType?: string(name='ChargeType'),
      commodityCode?: string(name='CommodityCode'),
      dataSetVersion?: string(name='DataSetVersion'),
      expiredTime?: string(name='ExpiredTime'),
      gmtCreate?: string(name='GmtCreate'),
      gmtModified?: string(name='GmtModified'),
      industry?: string(name='Industry'),
      instanceId?: string(name='InstanceId'),
      lockMode?: string(name='LockMode'),
      name?: string(name='Name'),
      regionId?: string(name='RegionId'),
      scene?: string(name='Scene'),
      status?: string(name='Status'),
      type?: string(name='Type'),
    }
  ](name='Result'),
}

model ListInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListInstanceResponseBody(name='body'),
}

async function listInstance(request: ListInstanceRequest): ListInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listInstanceWithOptions(request, headers, runtime);
}

async function listInstanceWithOptions(request: ListInstanceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListInstanceResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.expiredTime)) {
    query['ExpiredTime'] = request.expiredTime;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstance',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListInstanceTaskResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      name?: string(name='Name'),
      subProgressInfos?: [ 
        {
          detail?: string(name='Detail'),
          finishedNum?: int32(name='FinishedNum'),
          progress?: int32(name='Progress'),
          totalNum?: int32(name='TotalNum'),
          type?: string(name='Type'),
        }
      ](name='SubProgressInfos'),
      totalProgress?: int32(name='TotalProgress'),
    }
  ](name='Result'),
}

model ListInstanceTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListInstanceTaskResponseBody(name='body'),
}

async function listInstanceTask(InstanceId: string): ListInstanceTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listInstanceTaskWithOptions(InstanceId, headers, runtime);
}

async function listInstanceTaskWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListInstanceTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListInstanceTask',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/tasks`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListItemsRequest {
  page?: int32(name='Page'),
  size?: int32(name='Size'),
}

model ListItemsResponseBody = {
  requestId?: string(name='RequestId'),
  result?: {
    detail?: [ 
      {
        author?: string(name='Author'),
        brandId?: string(name='BrandId'),
        categoryPath?: string(name='CategoryPath'),
        channel?: string(name='Channel'),
        duration?: string(name='Duration'),
        expireTime?: string(name='ExpireTime'),
        itemId?: string(name='ItemId'),
        itemType?: string(name='ItemType'),
        pubTime?: string(name='PubTime'),
        shopId?: string(name='ShopId'),
        status?: string(name='Status'),
        title?: string(name='Title'),
      }
    ](name='Detail'),
    total?: {
      instanceRecommendItem?: long(name='InstanceRecommendItem'),
      queryCount?: long(name='QueryCount'),
      sceneRecommendItem?: long(name='SceneRecommendItem'),
      sceneWeightItem?: long(name='SceneWeightItem'),
      totalCount?: long(name='TotalCount'),
      weightItem?: long(name='WeightItem'),
    }(name='Total'),
  }(name='Result'),
}

model ListItemsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListItemsResponseBody(name='body'),
}

async function listItems(InstanceId: string, request: ListItemsRequest): ListItemsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listItemsWithOptions(InstanceId, request, headers, runtime);
}

async function listItemsWithOptions(InstanceId: string, request: ListItemsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListItemsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.page)) {
    query['Page'] = request.page;
  }
  if (!Util.isUnset(request.size)) {
    query['Size'] = request.size;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListItems',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/items/actions/list`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListLogsRequest {
  endTime?: int32(name='EndTime'),
  page?: int32(name='Page'),
  queryParams?: string(name='QueryParams'),
  size?: int32(name='Size'),
  startTime?: int32(name='StartTime'),
}

model ListLogsResponseBody = {
  headers?: {
    xTotalCount?: int32(name='X-Total-Count'),
  }(name='Headers'),
  requestId?: string(name='RequestId'),
  result?: [  map[string]any ](name='Result'),
}

model ListLogsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListLogsResponseBody(name='body'),
}

async function listLogs(InstanceId: string, request: ListLogsRequest): ListLogsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listLogsWithOptions(InstanceId, request, headers, runtime);
}

async function listLogsWithOptions(InstanceId: string, request: ListLogsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListLogsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.page)) {
    query['Page'] = request.page;
  }
  if (!Util.isUnset(request.queryParams)) {
    query['QueryParams'] = request.queryParams;
  }
  if (!Util.isUnset(request.size)) {
    query['Size'] = request.size;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListLogs',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/logs`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListMixResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      gmtCreate?: string(name='GmtCreate'),
      gmtModified?: string(name='GmtModified'),
      name?: string(name='Name'),
      parameter?: {
        settings?: [ 
          {
            name?: string(name='Name'),
            value?: int32(name='Value'),
          }
        ](name='Settings'),
      }(name='Parameter'),
    }
  ](name='Result'),
}

model ListMixResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListMixResponseBody(name='body'),
}

async function listMix(InstanceId: string): ListMixResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listMixWithOptions(InstanceId, headers, runtime);
}

async function listMixWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListMixResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListMix',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/mixes`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListRuleConditionsResponseBody = {
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      selectType?: string(name='SelectType'),
      selectValue?: string(name='SelectValue'),
      selectionOperation?: string(name='SelectionOperation'),
    }
  ](name='Result'),
}

model ListRuleConditionsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListRuleConditionsResponseBody(name='body'),
}

async function listRuleConditions(InstanceId: string): ListRuleConditionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listRuleConditionsWithOptions(InstanceId, headers, runtime);
}

async function listRuleConditionsWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListRuleConditionsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListRuleConditions',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/rule-conditions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListRuleTasksRequest {
  sceneId?: string(name='SceneId'),
}

model ListRuleTasksResponseBody = {
  requestId?: string(name='RequestId'),
  result?: {
    finishRate?: int32(name='FinishRate'),
    finishTime?: int32(name='FinishTime'),
  }(name='Result'),
}

model ListRuleTasksResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListRuleTasksResponseBody(name='body'),
}

async function listRuleTasks(InstanceId: string, request: ListRuleTasksRequest): ListRuleTasksResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listRuleTasksWithOptions(InstanceId, request, headers, runtime);
}

async function listRuleTasksWithOptions(InstanceId: string, request: ListRuleTasksRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListRuleTasksResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.sceneId)) {
    query['SceneId'] = request.sceneId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRuleTasks',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/rule-tasks`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListRulesRequest {
  endTime?: long(name='EndTime'),
  ruleType?: string(name='RuleType'),
  sceneId?: string(name='SceneId'),
  startTime?: long(name='StartTime'),
  status?: string(name='Status'),
  page?: int32(name='page'),
  size?: int32(name='size'),
}

model ListRulesResponseBody = {
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      gmtCreate?: string(name='GmtCreate'),
      gmtModified?: string(name='GmtModified'),
      ruleId?: string(name='RuleId'),
      status?: string(name='Status'),
    }
  ](name='Result'),
}

model ListRulesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListRulesResponseBody(name='body'),
}

async function listRules(InstanceId: string, request: ListRulesRequest): ListRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listRulesWithOptions(InstanceId, request, headers, runtime);
}

async function listRulesWithOptions(InstanceId: string, request: ListRulesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListRulesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.ruleType)) {
    query['RuleType'] = request.ruleType;
  }
  if (!Util.isUnset(request.sceneId)) {
    query['SceneId'] = request.sceneId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRules',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/rules`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListSceneItemsRequest {
  operationRuleId?: string(name='OperationRuleId'),
  page?: int32(name='Page'),
  previewType?: string(name='PreviewType'),
  queryCount?: int32(name='QueryCount'),
  selectionRuleId?: string(name='SelectionRuleId'),
  size?: int32(name='Size'),
}

model ListSceneItemsResponseBody = {
  requestId?: string(name='RequestId'),
  result?: {
    detail?: [ 
      {
        author?: string(name='Author'),
        brandId?: string(name='BrandId'),
        categoryPath?: string(name='CategoryPath'),
        channel?: string(name='Channel'),
        duration?: string(name='Duration'),
        expireTime?: string(name='ExpireTime'),
        itemId?: string(name='ItemId'),
        itemType?: string(name='ItemType'),
        pubTime?: string(name='PubTime'),
        shopId?: string(name='ShopId'),
        status?: string(name='Status'),
        title?: string(name='Title'),
      }
    ](name='Detail'),
    total?: {
      instanceRecommendItem?: long(name='InstanceRecommendItem'),
      sceneRecommendItem?: long(name='SceneRecommendItem'),
      sceneWeightItem?: long(name='SceneWeightItem'),
      totalCount?: long(name='TotalCount'),
      weightItem?: long(name='WeightItem'),
    }(name='Total'),
  }(name='Result'),
}

model ListSceneItemsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListSceneItemsResponseBody(name='body'),
}

async function listSceneItems(InstanceId: string, SceneId: string, request: ListSceneItemsRequest): ListSceneItemsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listSceneItemsWithOptions(InstanceId, SceneId, request, headers, runtime);
}

async function listSceneItemsWithOptions(InstanceId: string, SceneId: string, request: ListSceneItemsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListSceneItemsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.operationRuleId)) {
    query['OperationRuleId'] = request.operationRuleId;
  }
  if (!Util.isUnset(request.page)) {
    query['Page'] = request.page;
  }
  if (!Util.isUnset(request.previewType)) {
    query['PreviewType'] = request.previewType;
  }
  if (!Util.isUnset(request.queryCount)) {
    query['QueryCount'] = request.queryCount;
  }
  if (!Util.isUnset(request.selectionRuleId)) {
    query['SelectionRuleId'] = request.selectionRuleId;
  }
  if (!Util.isUnset(request.size)) {
    query['Size'] = request.size;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSceneItems',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/scenes/${OpenApiUtil.getEncodeParam(SceneId)}/items`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListScenesRequest {
  status?: string(name='Status'),
}

model ListScenesResponseBody = {
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      gmtCreate?: string(name='GmtCreate'),
      gmtModified?: string(name='GmtModified'),
      sceneId?: string(name='SceneId'),
      status?: string(name='Status'),
    }
  ](name='Result'),
}

model ListScenesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListScenesResponseBody(name='body'),
}

async function listScenes(InstanceId: string, request: ListScenesRequest): ListScenesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listScenesWithOptions(InstanceId, request, headers, runtime);
}

async function listScenesWithOptions(InstanceId: string, request: ListScenesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListScenesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListScenes',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/scenes`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListUmengAppkeysResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      appkey?: string(name='Appkey'),
      name?: string(name='Name'),
      platform?: string(name='Platform'),
    }
  ](name='Result'),
}

model ListUmengAppkeysResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListUmengAppkeysResponseBody(name='body'),
}

async function listUmengAppkeys(): ListUmengAppkeysResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listUmengAppkeysWithOptions(headers, runtime);
}

async function listUmengAppkeysWithOptions(headers: map[string]string, runtime: Util.RuntimeOptions): ListUmengAppkeysResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListUmengAppkeys',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/umeng/appkeys`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ModifyDataSourceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    meta?: {
      accessKeyId?: string(name='AccessKeyId'),
      bucketName?: string(name='BucketName'),
      partition?: string(name='Partition'),
      path?: string(name='Path'),
      projectName?: string(name='ProjectName'),
      tableName?: string(name='TableName'),
      timestamp?: long(name='Timestamp'),
      type?: string(name='Type'),
    }(name='Meta'),
    tableName?: string(name='TableName'),
  }(name='Result'),
}

model ModifyDataSourceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyDataSourceResponseBody(name='body'),
}

async function modifyDataSource(InstanceId: string, TableName: string): ModifyDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyDataSourceWithOptions(InstanceId, TableName, headers, runtime);
}

async function modifyDataSourceWithOptions(InstanceId: string, TableName: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyDataSourceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyDataSource',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/dataSources/${OpenApiUtil.getEncodeParam(TableName)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ModifyDiversifyResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    name?: string(name='Name'),
    parameter?: {
      categoryIndex?: int32(name='CategoryIndex'),
      window?: int32(name='Window'),
    }(name='Parameter'),
  }(name='Result'),
}

model ModifyDiversifyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyDiversifyResponseBody(name='body'),
}

async function modifyDiversify(InstanceId: string, Name: string): ModifyDiversifyResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyDiversifyWithOptions(InstanceId, Name, headers, runtime);
}

async function modifyDiversifyWithOptions(InstanceId: string, Name: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyDiversifyResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyDiversify',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/diversifies/${OpenApiUtil.getEncodeParam(Name)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ModifyExposureSettingsResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    durationSeconds?: int32(name='DurationSeconds'),
    scenarioBased?: boolean(name='ScenarioBased'),
  }(name='Result'),
}

model ModifyExposureSettingsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyExposureSettingsResponseBody(name='body'),
}

async function modifyExposureSettings(InstanceId: string): ModifyExposureSettingsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyExposureSettingsWithOptions(InstanceId, headers, runtime);
}

async function modifyExposureSettingsWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyExposureSettingsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyExposureSettings',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/exposure-settings`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ModifyInstanceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    chargeType?: string(name='ChargeType'),
    commodityCode?: string(name='CommodityCode'),
    dataSetVersion?: string(name='DataSetVersion'),
    expiredTime?: string(name='ExpiredTime'),
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    industry?: string(name='Industry'),
    instanceId?: string(name='InstanceId'),
    lockMode?: string(name='LockMode'),
    name?: string(name='Name'),
    regionId?: string(name='RegionId'),
    scene?: string(name='Scene'),
    status?: string(name='Status'),
    type?: string(name='Type'),
  }(name='Result'),
}

model ModifyInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyInstanceResponseBody(name='body'),
}

async function modifyInstance(InstanceId: string): ModifyInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyInstanceWithOptions(InstanceId, headers, runtime);
}

async function modifyInstanceWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyInstance',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ModifyItemsResponseBody = {
  requestId?: string(name='RequestId'),
  result?: boolean(name='Result'),
}

model ModifyItemsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyItemsResponseBody(name='body'),
}

async function modifyItems(InstanceId: string): ModifyItemsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyItemsWithOptions(InstanceId, headers, runtime);
}

async function modifyItemsWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyItemsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyItems',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/items`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ModifyMixResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    name?: string(name='Name'),
    parameter?: {
      settings?: [ 
        {
          name?: string(name='Name'),
          value?: int32(name='Value'),
        }
      ](name='Settings'),
    }(name='Parameter'),
  }(name='Result'),
}

model ModifyMixResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyMixResponseBody(name='body'),
}

async function modifyMix(InstanceId: string, Name: string): ModifyMixResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyMixWithOptions(InstanceId, Name, headers, runtime);
}

async function modifyMixWithOptions(InstanceId: string, Name: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyMixResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyMix',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/mixes/${OpenApiUtil.getEncodeParam(Name)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ModifyRuleResponseBody = {
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    ruleId?: string(name='RuleId'),
    ruleMeta?: map[string]any(name='RuleMeta'),
    status?: string(name='Status'),
  }(name='Result'),
}

model ModifyRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyRuleResponseBody(name='body'),
}

async function modifyRule(InstanceId: string, RuleId: string): ModifyRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyRuleWithOptions(InstanceId, RuleId, headers, runtime);
}

async function modifyRuleWithOptions(InstanceId: string, RuleId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyRuleResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyRule',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/rules/${OpenApiUtil.getEncodeParam(RuleId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ModifySceneResponseBody = {
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: string(name='GmtCreate'),
    gmtModified?: string(name='GmtModified'),
    sceneId?: string(name='SceneId'),
    status?: string(name='Status'),
  }(name='Result'),
}

model ModifySceneResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifySceneResponseBody(name='body'),
}

async function modifyScene(InstanceId: string, SceneId: string): ModifySceneResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifySceneWithOptions(InstanceId, SceneId, headers, runtime);
}

async function modifySceneWithOptions(InstanceId: string, SceneId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifySceneResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyScene',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/scenes/${OpenApiUtil.getEncodeParam(SceneId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model PublishRuleRequest {
  ruleType?: string(name='RuleType'),
  sceneId?: string(name='SceneId'),
}

model PublishRuleResponseBody = {
  requestId?: string(name='RequestId'),
  result?: {
    ruleId?: string(name='RuleId'),
  }(name='Result'),
}

model PublishRuleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PublishRuleResponseBody(name='body'),
}

async function publishRule(InstanceId: string, RuleId: string, request: PublishRuleRequest): PublishRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return publishRuleWithOptions(InstanceId, RuleId, request, headers, runtime);
}

async function publishRuleWithOptions(InstanceId: string, RuleId: string, request: PublishRuleRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PublishRuleResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.ruleType)) {
    query['RuleType'] = request.ruleType;
  }
  if (!Util.isUnset(request.sceneId)) {
    query['SceneId'] = request.sceneId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PublishRule',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/rules/${OpenApiUtil.getEncodeParam(RuleId)}/actions/publish`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model PushDocumentResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: boolean(name='Result'),
}

model PushDocumentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PushDocumentResponseBody(name='body'),
}

async function pushDocument(InstanceId: string, TableName: string): PushDocumentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return pushDocumentWithOptions(InstanceId, TableName, headers, runtime);
}

async function pushDocumentWithOptions(InstanceId: string, TableName: string, headers: map[string]string, runtime: Util.RuntimeOptions): PushDocumentResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'PushDocument',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/tables/${OpenApiUtil.getEncodeParam(TableName)}/actions/bulk`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model PushInterventionResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: boolean(name='Result'),
}

model PushInterventionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PushInterventionResponseBody(name='body'),
}

async function pushIntervention(InstanceId: string): PushInterventionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return pushInterventionWithOptions(InstanceId, headers, runtime);
}

async function pushInterventionWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): PushInterventionResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'PushIntervention',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/actions/intervene`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model QueryDataMessageRequest {
  bhvType?: string(name='BhvType'),
  cmdType?: string(name='CmdType'),
  endTime?: long(name='EndTime'),
  itemId?: string(name='ItemId'),
  itemType?: string(name='ItemType'),
  messageSource?: string(name='MessageSource'),
  page?: int32(name='Page'),
  sceneId?: string(name='SceneId'),
  size?: int32(name='Size'),
  startTime?: long(name='StartTime'),
  traceId?: string(name='TraceId'),
  userId?: string(name='UserId'),
  userType?: string(name='UserType'),
}

model QueryDataMessageResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: map[string]any(name='Result'),
}

model QueryDataMessageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryDataMessageResponseBody(name='body'),
}

async function queryDataMessage(InstanceId: string, Table: string, request: QueryDataMessageRequest): QueryDataMessageResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryDataMessageWithOptions(InstanceId, Table, request, headers, runtime);
}

async function queryDataMessageWithOptions(InstanceId: string, Table: string, request: QueryDataMessageRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryDataMessageResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.bhvType)) {
    query['BhvType'] = request.bhvType;
  }
  if (!Util.isUnset(request.cmdType)) {
    query['CmdType'] = request.cmdType;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.itemId)) {
    query['ItemId'] = request.itemId;
  }
  if (!Util.isUnset(request.itemType)) {
    query['ItemType'] = request.itemType;
  }
  if (!Util.isUnset(request.messageSource)) {
    query['MessageSource'] = request.messageSource;
  }
  if (!Util.isUnset(request.page)) {
    query['Page'] = request.page;
  }
  if (!Util.isUnset(request.sceneId)) {
    query['SceneId'] = request.sceneId;
  }
  if (!Util.isUnset(request.size)) {
    query['Size'] = request.size;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.traceId)) {
    query['TraceId'] = request.traceId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userType)) {
    query['UserType'] = request.userType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryDataMessage',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/tables/${OpenApiUtil.getEncodeParam(Table)}/data-message`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model QueryDataMessageStatisticsRequest {
  bhvType?: string(name='BhvType'),
  cmdType?: string(name='CmdType'),
  endTime?: long(name='EndTime'),
  itemId?: string(name='ItemId'),
  itemType?: string(name='ItemType'),
  messageSource?: string(name='MessageSource'),
  sceneId?: string(name='SceneId'),
  startTime?: long(name='StartTime'),
  traceId?: string(name='TraceId'),
  userId?: string(name='UserId'),
  userType?: string(name='UserType'),
}

model QueryDataMessageStatisticsResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: map[string]any(name='Result'),
}

model QueryDataMessageStatisticsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryDataMessageStatisticsResponseBody(name='body'),
}

async function queryDataMessageStatistics(InstanceId: string, Table: string, request: QueryDataMessageStatisticsRequest): QueryDataMessageStatisticsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryDataMessageStatisticsWithOptions(InstanceId, Table, request, headers, runtime);
}

async function queryDataMessageStatisticsWithOptions(InstanceId: string, Table: string, request: QueryDataMessageStatisticsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryDataMessageStatisticsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.bhvType)) {
    query['BhvType'] = request.bhvType;
  }
  if (!Util.isUnset(request.cmdType)) {
    query['CmdType'] = request.cmdType;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.itemId)) {
    query['ItemId'] = request.itemId;
  }
  if (!Util.isUnset(request.itemType)) {
    query['ItemType'] = request.itemType;
  }
  if (!Util.isUnset(request.messageSource)) {
    query['MessageSource'] = request.messageSource;
  }
  if (!Util.isUnset(request.sceneId)) {
    query['SceneId'] = request.sceneId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.traceId)) {
    query['TraceId'] = request.traceId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userType)) {
    query['UserType'] = request.userType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryDataMessageStatistics',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/tables/${OpenApiUtil.getEncodeParam(Table)}/data-message-statistics`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model QueryExceptionHistoryRequest {
  endTime?: long(name='EndTime'),
  startTime?: long(name='StartTime'),
  type?: string(name='Type'),
}

model QueryExceptionHistoryResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: map[string]any(name='Result'),
}

model QueryExceptionHistoryResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryExceptionHistoryResponseBody(name='body'),
}

async function queryExceptionHistory(InstanceId: string, request: QueryExceptionHistoryRequest): QueryExceptionHistoryResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryExceptionHistoryWithOptions(InstanceId, request, headers, runtime);
}

async function queryExceptionHistoryWithOptions(InstanceId: string, request: QueryExceptionHistoryRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryExceptionHistoryResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryExceptionHistory',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/sync-reports/exception-history`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model QueryRawDataRequest {
  itemId?: string(name='ItemId'),
  itemType?: string(name='ItemType'),
  userId?: string(name='UserId'),
  userType?: string(name='UserType'),
}

model QueryRawDataResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: map[string]any(name='Result'),
}

model QueryRawDataResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryRawDataResponseBody(name='body'),
}

async function queryRawData(InstanceId: string, Table: string, request: QueryRawDataRequest): QueryRawDataResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryRawDataWithOptions(InstanceId, Table, request, headers, runtime);
}

async function queryRawDataWithOptions(InstanceId: string, Table: string, request: QueryRawDataRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryRawDataResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.itemId)) {
    query['ItemId'] = request.itemId;
  }
  if (!Util.isUnset(request.itemType)) {
    query['ItemType'] = request.itemType;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userType)) {
    query['UserType'] = request.userType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryRawData',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/tables/${OpenApiUtil.getEncodeParam(Table)}/raw-data`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model QuerySingleAggregationReportResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: map[string]any(name='Result'),
}

model QuerySingleAggregationReportResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QuerySingleAggregationReportResponseBody(name='body'),
}

async function querySingleAggregationReport(InstanceId: string): QuerySingleAggregationReportResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return querySingleAggregationReportWithOptions(InstanceId, headers, runtime);
}

async function querySingleAggregationReportWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): QuerySingleAggregationReportResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'QuerySingleAggregationReport',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/sync-reports/single-aggregation-report`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model QuerySingleReportRequest {
  reportType?: string(name='ReportType'),
}

model QuerySingleReportResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: map[string]any(name='Result'),
}

model QuerySingleReportResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QuerySingleReportResponseBody(name='body'),
}

async function querySingleReport(InstanceId: string, request: QuerySingleReportRequest): QuerySingleReportResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return querySingleReportWithOptions(InstanceId, request, headers, runtime);
}

async function querySingleReportWithOptions(InstanceId: string, request: QuerySingleReportRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QuerySingleReportResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.reportType)) {
    query['ReportType'] = request.reportType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QuerySingleReport',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/sync-reports/single-report`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model QuerySyncReportAggregationRequest {
  endTime?: long(name='EndTime'),
  startTime?: long(name='StartTime'),
}

model QuerySyncReportAggregationResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: map[string]any(name='Result'),
}

model QuerySyncReportAggregationResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QuerySyncReportAggregationResponseBody(name='body'),
}

async function querySyncReportAggregation(InstanceId: string, request: QuerySyncReportAggregationRequest): QuerySyncReportAggregationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return querySyncReportAggregationWithOptions(InstanceId, request, headers, runtime);
}

async function querySyncReportAggregationWithOptions(InstanceId: string, request: QuerySyncReportAggregationRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QuerySyncReportAggregationResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QuerySyncReportAggregation',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/sync-reports/aggregation`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model RecommendHeaders {
  commonHeaders?: map[string]string,
  regionId?: string(name='RegionId'),
}

model RecommendRequest {
  imei?: string(name='Imei'),
  ip?: string(name='Ip'),
  items?: string(name='Items'),
  returnCount?: int32(name='ReturnCount'),
  sceneId?: string(name='SceneId'),
  userId?: string(name='UserId'),
}

model RecommendResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: [ 
    {
      itemId?: string(name='ItemId'),
      itemType?: string(name='ItemType'),
      matchInfo?: string(name='MatchInfo'),
      position?: int32(name='Position'),
      traceId?: string(name='TraceId'),
      traceInfo?: string(name='TraceInfo'),
      weight?: float(name='Weight'),
    }
  ](name='Result'),
}

model RecommendResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RecommendResponseBody(name='body'),
}

async function recommend(InstanceId: string, request: RecommendRequest): RecommendResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new RecommendHeaders{};
  return recommendWithOptions(InstanceId, request, headers, runtime);
}

async function recommendWithOptions(InstanceId: string, request: RecommendRequest, headers: RecommendHeaders, runtime: Util.RuntimeOptions): RecommendResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.imei)) {
    query['Imei'] = request.imei;
  }
  if (!Util.isUnset(request.ip)) {
    query['Ip'] = request.ip;
  }
  if (!Util.isUnset(request.items)) {
    query['Items'] = request.items;
  }
  if (!Util.isUnset(request.returnCount)) {
    query['ReturnCount'] = request.returnCount;
  }
  if (!Util.isUnset(request.sceneId)) {
    query['SceneId'] = request.sceneId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.regionId)) {
    realHeaders['RegionId'] = Util.toJSONString(headers.regionId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'Recommend',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/actions/recommend`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model RunInstanceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: boolean(name='Result'),
}

model RunInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RunInstanceResponseBody(name='body'),
}

async function runInstance(InstanceId: string): RunInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return runInstanceWithOptions(InstanceId, headers, runtime);
}

async function runInstanceWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): RunInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'RunInstance',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/actions/import`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model StopDataSetResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    gmtCreate?: long(name='GmtCreate'),
    gmtModified?: long(name='GmtModified'),
    instanceId?: string(name='InstanceId'),
    state?: string(name='State'),
    versionId?: string(name='VersionId'),
  }(name='Result'),
}

model StopDataSetResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StopDataSetResponseBody(name='body'),
}

async function stopDataSet(InstanceId: string, VersionId: string): StopDataSetResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return stopDataSetWithOptions(InstanceId, VersionId, headers, runtime);
}

async function stopDataSetWithOptions(InstanceId: string, VersionId: string, headers: map[string]string, runtime: Util.RuntimeOptions): StopDataSetResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'StopDataSet',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/dataSets/${OpenApiUtil.getEncodeParam(VersionId)}/actions/stop`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model UpgradeInstanceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    instanceId?: string(name='InstanceId'),
  }(name='Result'),
}

model UpgradeInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpgradeInstanceResponseBody(name='body'),
}

async function upgradeInstance(InstanceId: string): UpgradeInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return upgradeInstanceWithOptions(InstanceId, headers, runtime);
}

async function upgradeInstanceWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): UpgradeInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'UpgradeInstance',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/actions/upgrade`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ValidateInstanceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: boolean(name='Result'),
}

model ValidateInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ValidateInstanceResponseBody(name='body'),
}

async function validateInstance(InstanceId: string): ValidateInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return validateInstanceWithOptions(InstanceId, headers, runtime);
}

async function validateInstanceWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ValidateInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ValidateInstance',
    version = '2018-10-12',
    protocol = 'HTTPS',
    pathname = `/openapi/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/actions/validate`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

